<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>vue基础知识</title>

</head>
<body>
    <div id="app">
        <a href="#/login">用户登录</a>
        <a href="#/register">用户注册</a>
        <!--显示路由组件标签-->
        <router-view></router-view>
    </div>

</body>
</html>


<script src="js/vue.js"></script>
<script src="js/vue-router.js"></script>

<script>
    const register = {
        template: `<div><button value="注册"></button></div>`
    }
    const notFound = {
        template:`<div><h3>404 Not Found!,当前页面走丢了!!!!</h3></div>`
    }

    const login = {
        template:`<div><a>router</a></div>`
    };

    let router = new VueRouter({
        routes:[
            {path:'/',redirect:'/login'},
            {path:'/login',component:login},
            {path:'/register',component:register},
            {path:'*',component:notFound},
        ]
    });


    var app = new Vue({
        el: "#app",
        data: {
            msg: "商品列表"
        },
        //局部组件
        router
    })
</script>
